package com.qf.controller.statistics;

import com.qf.service.DtsGoodsService;
import com.qf.service.DtsOrderService;
import com.qf.service.DtsUserService;
import com.qf.util.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;

/**
 * @author bss
 */
@RestController
@RequestMapping("/admin/stat")
public class AdminStatController {

    @Autowired
    DtsUserService userService;
    @Autowired
    DtsOrderService orderService;
    @Autowired
    DtsGoodsService goodsService;

    @GetMapping("/user")
    public Object user(){
        Map<String, Object> data = userService.selectUserStat();
        return ResponseUtil.ok(data);
    }

    @GetMapping("/order")
    public Object order(){
        Map<String, Object> data = orderService.selectOrderStat();
        return ResponseUtil.ok(data);
    }

    @GetMapping("/goods")
    public Object goods(){
        Map<String,Object> data = goodsService.selectGoodsStat();
        return ResponseUtil.ok(data);
    }
}
